import { useState } from "react";
import { useNavigate } from "react-router";

export default function Company() {

   const navigate=  useNavigate();

    const edit=(id:number)=>{

        //search传参
         navigate(`/edit?id=${id}&type=100`);

    
    }
    const show=(id:number)=>{

        //search传参
         navigate(`/show/${id}`);

    
    }

    const [list, setList]=useState([
        {
            id:1,name:"北京科技有限公司"
        },
        {
            id:2,name:"深圳科技有限公司"
        }
    ]);
  return (
    <div>
      <h1>Company</h1>
       {
         list.map(item=>{
             return <div key={item.id}>

                <span onClick={()=>show(item.id)}> {item.name}</span>
                <button onClick={()=>edit(item.id)}>修改</button>
             
             </div>
         })
       }

      

    </div>
  );
}